<?php
/*************************************************

用户主模型 - the 
Author: WangHuabin <17-5-26>

*************************************************/
namespace Home\Model;
use Think\Model\RelationModel;
class UserModel extends RelationModel {


    //查询单数据
    public function get_one($map){
        $data = $this->where($map)->find();
        return $data;
    }
    public function get_all($map){
        $data = $this->where($map)->select();
        return $data;
    }
    //添加
    public function add($data){
        $data = M('User')->data($data)->add();
        return M('User')->getLastInsID();
    }

     //更新
    public function edit($map,$data){
        $r = $this->where($map)->save($data);
        return $r;
    }

    //统计
    public function count($map){
        $r =M('User')->where($map)->count($data);
        return $r;
    }
    //余额更改
    public function balance($map,$balance) {
            $res = $this->where($map)->setDec('balance',$balance);
            return $res;
    }

    //推手提现
	public function prize_balance($map,$balance) {
            $res = $this->where($map)->setDec('prize_balance',$balance);
            return $res;
    }
	
	//积分
    public function set_score($map,$score) {
            $res = $this->where($map)->setInc('score',$score);
            return $res;
    } 


}